package com.srcptit.tranning.toannt.btvn1;
import java.util.Scanner;
public class Phantich_songto {
public static void main(String[]args){
	Scanner sc=new Scanner(System.in);
	System.out.println("Nhap vao so can phan tich: ");
	int n=sc.nextInt();
	Phantich(n);
}
public static void Phantich(int n){
	int dem;
	int m=(int)Math.sqrt(n);
	for(int i = 2; i <= m; i++){
        dem = 0;
        if(n % i == 0){
            while(n % i == 0){
                n = n / i;
                dem++;
            }
        }
        if(dem != 0) System.out.println(i+"^"+ dem);
        m = (int)Math.sqrt(n);
    }
    if(n > 1) System.out.println(n+"^"+1);

}
}
